//
//  YGRefreshViewCell.m
//  luGongPro
//
//  Created by 王庆学 on 2017/8/28.
//  Copyright © 2017年 王庆学. All rights reserved.
//

#import "YGRefreshViewCell.h"
#import "EFSRefreshView.h"

@interface YGRefreshViewCell ()
@property (nonatomic, strong) EFSRefreshView *refreshView;
@end

@implementation YGRefreshViewCell

- (id)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if (self){
        [self initializeRefreshView];
    }
    return self;
}

- (id)initWithCoder:(NSCoder *)aDecoder{
    self = [super initWithCoder:aDecoder];
    if (self){
        [self initializeRefreshView];
    }
    return self;
}

- (void)initializeRefreshView{
    _refreshView = [[EFSRefreshView alloc] initWithRefreshStatus:RefreshStatusTypeEmpty];
    _refreshView.frame = CGRectMake(0, 0, 200, 300);
    _refreshView.center = CGPointMake(kWidth / 2, 150);
    _refreshView.refreshButton.hidden = YES;
    
    _refreshView.backgroundColor = [UIColor colorFromHexString:@"ffffff" alpha:0.8];
    [self.contentView addSubview:_refreshView];
}

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

#pragma mark YGCellProtocol

- (void)bindModel:(YGRefreshModel *)model{
    if (model.refreshStatus == YGRefreshStatusTypeEmpty){
        [_refreshView configRefreshStatus:RefreshStatusTypeEmpty];
    }else if (model.refreshStatus == YGRefreshStatusTypeNoData){
        [_refreshView configRefreshStatus:RefreshStatusTypeNoData];
    }else if (model.refreshStatus == YGRefreshStatusTypeError){
        [_refreshView configRefreshStatus:RefreshStatusTypeError];
    }
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
